Optimizing performance
When working with RWTH - Mindstorms NXT Toolbox and USB connections, high packet rates of more than 100 sensor or motor readings per second are common. In order to achieve such short latency for MATLAB - NXT communication, high CPU load is generated, being the speed limit on slow machines.
To improve performance, a function called
OptimizeToolboxPerformance
is provided. It will replace the frequently called function typecast with a faster binary version (typecastc). The binary MEX-files are already included in your MATLAB installation directory. But since they reside in a private directory, they cannot be accessed from the outside. That is why OptimizeToolboxPerformance will try to copy all binary files to the toolboxes own private directory. So, before calling the function, make sure you got write access where you installed RWTH - Mindstorms NXT Toolbox.
The function OptimizeToolboxPerformance is fail-safe and verifies each step. The user is asked before action is taken. Just run the command to improve your toolbox performance by a factor of up to 3 (depending on your machine of course). If it succeeds, the lowlevel functions wordbytes2dec and dec2wordbytes will have been replaced by faster versions, leading to less CPU load needed (and hence faster toolbox speed).
Please note that the function only copies files that are already present in you MATLAB installation. So the optimization will most likely only work for the specific MATLAB version, and only for the operating system you ran the command from.